package com.cookizz.waterfalldemo;

import com.cookizz.waterfall.LazyLoadListener;
import com.cookizz.waterfall.Waterfall;
import android.support.v7.app.ActionBarActivity;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import android.view.Window;

public class MainActivity extends ActionBarActivity {

	private Waterfall mWaterfall;
	
	@SuppressLint({ "NewApi", "InflateParams" })
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.activity_main);
		
		mWaterfall = (Waterfall) findViewById(R.id.waterfall);
		View footer = getLayoutInflater().inflate(R.layout.waterfall_item_footer, null);
		mWaterfall.addFooterView(footer);
		
		final MyAdapter adapter = new MyAdapter(this, ImagePageIterator.getNextPageList());
		mWaterfall.setAdapter(adapter);
		mWaterfall.addLazyLoadListener(new LazyLoadListener() {
			@Override
			public void onLazyLoadReady() {
				adapter.loadNewPage();
			}
			@Override
			public void onLazyLoadFinish() {
				// TODO your code here
			}
		});
	}
}
